import java.util.Comparator;
/**
* This class defines the comparisson operator for two nodes, defining the
* smallest one as the one that has a least predicted length for it's path
*/
public class NodeComparator implements Comparator<Node>
{
    public int compare(Node o1, Node o2)
    {
        if((o1.getPath().length() + o1.getWeight()) <
           (o2.getPath().length() + o2.getWeight()))
        {
            return -1;
        }
        else if((o1.getPath().length() + o1.getWeight()) >
                 (o2.getPath().length() + o2.getWeight()))
        {
            return 1;
        }
        return 0;
    }
//    	if(o1.getWeight() < o2.getWeight())
//        {
//            return -1;
//        }
//        else if(o1.getWeight() >
//                 o2.getWeight())
//        {
//            return 1;
//        }
//
//        return 0;
//    }
}
